<template>
  <section class="entry-table">
    <el-table
      :empty-text="data === null ? '加载中...' : '暂无数据'"
      :data="data || []"
      border
      :span-method="arraySpanMethod"
      :show-header="false"
      :highlight-current-row="false"
      :cell-class-name="getCellClassName"
    >
      <el-table-column prop="col0Title" align="center"> </el-table-column>
      <el-table-column prop="col1Title" align="center"> </el-table-column>
      <el-table-column prop="col2Title" align="center"> </el-table-column>
      <el-table-column prop="col3Title" align="center"> </el-table-column>
      <el-table-column prop="col4Title" align="center"> </el-table-column>
      <el-table-column prop="col5Title" align="center"> </el-table-column>
    </el-table>
  </section>
</template>

<script>
/**
 * @file 智能做账详情 / 往来挂账数据表
 */

export default {
  props: {
    data: {
      type: Array,
    },
  },
  data() {
    return {};
  },
  methods: {
    arraySpanMethod({ row, column, rowIndex, columnIndex }) {
      if (row.colSpans !== undefined && row.columnIndexs) {
        const index = row.columnIndexs.indexOf(columnIndex);
        if (index !== -1) {
          return [1, row.colSpans[index]];
        } else {
          return [1, 0];
        }
      }
    },
    /**
     * 获取单元格 class name
     */
    getCellClassName(data) {
      let className = "";
      if (
        data.row.headerTypes &&
        data.row.headerTypes.indexOf(data.columnIndex) !== -1
      ) {
        className = "table-header-cell";
      }
      return className;
    },
  },
};
</script>
<style lang="less" scoped>
@import "../../../assets/var.less";
</style>